<template>
	<view class="">
		<view class="mt-5" v-if="u_loadmore">
			<u-loadmore status="loading" icon-type="circle" />
		</view>
		<view v-else>
			<view class="m-2 bg-white rounded-20" @click="order_send">
				<view class="today_title px-3 py-2">
					<view class="d-flex j-sb pt">
						<view class="d-flex a-center">
							<view class="rounded-50 mr-1 d-flex user_img j-center a-center">
								<u-icon name="account-fill" color="#ff6b69" size="30"></u-icon>
							</view>
							<view class="font-weight">{{close_detail.mobile}}</view>
						</view>
						<view class="font-weight">{{close_detail.label_order_status}}</view>
					</view>
					<view class="d-flex j-sb text-light-muted pt-2">
						<view class="">{{close_detail.formated_add_time}}</view>
						<view class="">{{close_detail.order_sn}}</view>
					</view>
				</view>
				<view class="pl-3" v-for="(item,index) in close_detail.goods_items" :key="index">
					<view class="d-flex border-bottom py-3">
						<image class="today_hot rounded-20" :src="item.img.url" mode=""></image>
						<view class="m-2">
							<view class="">{{item.name}}</view>
						</view>
					</view>
					<view class="py-3">
						<text>共{{item.goods_number}}件</text><text>合计:{{close_detail.formated_order_amount}}</text>
					</view>
				</view>
			</view>
			<view class="m-2 p-3 bg-white d-flex j-sb rounded-20 clazz">
				<view class="">关闭理由</view>
				<view class="d-flex" @click="cause">
					<view class="">{{msgList==null?'请选择':msgList}}</view>
					<view class="ml-1">
						<u-icon name="arrow-right" color="#999999" size="35"></u-icon>
					</view>
				</view>
			</view>
			<view class="footer">
				
			</view>
			<view class="bg-white py-2 w-100 position-fixed bottom-0 btn">
				<button type="warn" @click="confirm_close">确定关闭</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				msgList:null,
				close_detail:"", // 关闭详情
				order_id:"", // 订单ID
				u_loadmore:true, // 加载中
			}
		},
		methods: {
			// 选择关闭订单的理由
			cause(){
				if(this.msgList){
					uni.navigateTo({
						url:"/pagesA/order/order-close-cause?title="+this.msgList
					})
				}else{
					uni.navigateTo({
						url:"/pagesA/order/order-close-cause"
					})
				}
				
			},
			// 确认关闭
			confirm_close(){
				this.$H.post("admin/order/operate/cancel",{order_id:this.order_id,cancel_note:this.msgList}).then(res=>{
					uni.navigateBack({
						delta:1
					})
				})
			}
		},
		onLoad(e) {
			this.$H.post("admin/orders/detail",{id:e.order_id}).then(res=>{
				this.order_id=e.order_id
				this.close_detail=res.data
				this.u_loadmore=false 
			})
		},
		onShow(){
			var globalData = getApp().globalData.closeLists;
			this.msgList=globalData
		}
	}
</script>

<style>
	.user_img{
		width: 40upx;
		height: 40upx;
		background-color: #ffd1d0;
	}
	.today_title{
		background-color: #f6efef;
	}
	.today_hot{
		width: 150upx;
		height: 150upx;
	}
	.btn /deep/ button{
		width: 85%;
		border-radius: 50upx;
		background: linear-gradient(to right,#F31E3E,#FB4F37);
	}
	.footer{
		height: 130upx;
		width: 100%;
	}
</style>
